package com.evenmo.tcp;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * This is Description
 * TCP服务端
 * @author moyongjun
 * @date 2019/11/24
 */
public class TCP_ServerDemo {

    public static void main(String[] args) throws IOException {
        //创建一个服务端
        ServerSocket serverSocket=new ServerSocket(20006);
    boolean flag=true;
        while(flag){

            Socket acceptSocket = serverSocket.accept();

            //创建一个服务端线程，和客户端进行通信
            new Thread(new TCP_ServerThread(acceptSocket)).start();
        }

        serverSocket.close();
    }
}
